import { request } from '@/utils/request';
// 文档列表相关的接口
/**
 * 根据用户id查询该用户所拥有的文档
 * @returns {Promise<ApiRet>}
 */
const searchDocList =()=>{
    const userId = localStorage.getItem('userId');
    return request({
        url: `/doc/getDocList`,
        method: "GET",
        params: { userId }
    })
}
/**
 * 根据文档id删除文档
 * @param {string} docId 文档id
 */

const deleteDocByDocIds = (docIdList)=>{
    return request({
        url: '/doc/deleteDocByDocIds',
        method: "DELETE",
        data: docIdList,
    })
}

/**
 * 根据文档名称查询文档
 * @param {string} name 文档名称
 */
const searchDocByName = ({name})=>{
    const params = {
        name
    }
    return request({
        url: '/doc/searchDocList',
        method: "GET",
        params
    })
}

export {
    searchDocList,
    deleteDocByDocIds,
    searchDocByName
}